import request from '@/utils/request'
const GEN_API_BASE_URL = '/code/application';

// 实体表搜索字段改变
export function searchChanged(query) {
  return request({
    url: `${GEN_API_BASE_URL}/searchChanged`,
    method: 'get',
    params: query
  })
}

// 查询应用列表
export function listApplication(query) {
  return request({
    url: `${GEN_API_BASE_URL}/list`,
    method: 'get',
    params: query
  })
}

// 查询应用详细
export function getNew(id) {
  return request({
    url: `${GEN_API_BASE_URL}/getNew`,
    method: 'get',
    params: {id: id}
  })
}

// 查询应用详细
export function getApplication(id) {
  return request({
    url: `${GEN_API_BASE_URL}/` + id,
    method: 'get'
  })
}

// 新增应用
export function addApplication(data) {
  return request({
    url: `${GEN_API_BASE_URL}`,
    method: 'post',
    data: data
  })
}

// 修改应用
export function updateApplication(data) {
  return request({
    url: `${GEN_API_BASE_URL}`,
    method: 'put',
    data: data
  })
}

// 删除应用
export function delApplication(id) {
  return request({
    url: `${GEN_API_BASE_URL}/` + id,
    method: 'delete'
  })
}

// 同步数据库
export function syncDb(id) {
  return request({
    url: `${GEN_API_BASE_URL}/syncDb/` + id,
    method: 'get',
    timeout: 60 * 60 * 1000
  })
}
